#include <cstdio>
const int N = 100005, mod = 1e9 + 7;
int n, a, b;
inline int qpow(int base, int index) {
	int res = 1;
	while (index) {
		if (index & 1) { res = 1ll * res * base % mod; }
		base = 1ll * base * base % mod;
		index >>= 1;
	}
	return res;
}
int l[N], t[N], f[5005][5005];
int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
	freopen("matrix.in", "r", stdin);
	freopen("matrix.out", "w", stdout);
#endif
#endif

	scanf("%d%d%d", &n, &a, &b);
	for (int i = 1; i <= n; ++i) { scanf("%d", &l[i]); }
	for (int i = 1; i <= n; ++i) { scanf("%d", &t[i]); }
	if (a == 0) {
		printf("%lld", 1ll * t[n] * qpow(b, n - 1) % mod);
	} else {
		for (int i = 1; i <= n; ++i) { f[i][1] = l[i], f[1][i] = t[i]; }
		for (int i = 2; i <= n; ++i) {
			for (int j = 2; j <= n; ++j) {
				f[i][j] = (1ll * a * f[i][j - 1] % mod + 1ll * b * f[i - 1][j] % mod) % mod;
			}
		}
		printf("%d", f[n][n]);
	}
	return 0;
}